package socketinterface.commands;

import java.io.IOException;

import socketinterface.ConsoleLogger;
import socketinterface.Logger;
import socketinterface.requests.ClientRequest;

public class IoRefreshrate implements ICommandPacket {
	private ClientRequest   clientRequest;
	private Logger          logger;
	private final short     size = 10;
	private int             refreshRate;
	private int             state;
	
	public IoRefreshrate (ClientRequest clientRequest, int refreshRate) {
		this.clientRequest = clientRequest;
		this.refreshRate = refreshRate;
		this.logger = new ConsoleLogger();
	}
	
	public void execute() {
		try {
			clientRequest.writeShort(size);
			clientRequest.writeShort(IoProtocol.PK_IO_REFRESHRATE);
			clientRequest.writeInt(refreshRate);
			clientRequest.writeShort(IoProtocol.PK_COMMAND_TERMINATE);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
